package com.kfm.base.thread.day01;

public class Demo06 {

    public static void main(String[] args) {

        Thread t1 = new Thread(() -> {
            for (int i = 0; i < 2; i++) {
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
        });

        System.out.println(t1.isAlive());
        t1.start();

        // 线程启动后尚未结束时返回 true
        System.out.println(t1.isAlive());

//        while (t1.isAlive()){
//            System.out.println("活着");
//        }

        System.out.println("died");
    }
}
